generic module HookReceiverP (am_id_t amId){
	provides{
		interface Receive;
		interface Packet;
		interface AMPacket;
	}
	uses{
		interface Receive as ReceiveM;
		interface Packet as PacketM;
		interface AMPacket as AMPacketM;
	}
}
implementation{
	event message_t* ReceiveM.receive(message_t* msg, void* payload, uint8_t len){	
		//TODO		
		dbg("AMReceiver", "Packet received\n");	
		signal Receive.receive(msg, payload, len);
	}
	//Packet
	command void Packet.clear(message_t* msg){
		
		return call PacketM.clear(msg);
	}
	
	command uint8_t Packet.payloadLength(message_t* msg){
		return call PacketM.payloadLength(msg);
	}
	
	command void Packet.setPayloadLength(message_t* msg, uint8_t len){
		return call PacketM.setPayloadLength(msg,len);
	}
	
	command uint8_t Packet.maxPayloadLength(){
		return call Packet.maxPayloadLength();
	}
	
	command void* Packet.getPayload(message_t* msg, uint8_t len){
		return call PacketM.getPayload(msg,len);
	}

	//AMPacket
	command am_addr_t AMPacket.address(){
		return call AMPacketM.address();
	}
	
	command am_addr_t AMPacket.destination(message_t* amsg){
		return call AMPacketM.destination(amsg);
	}
	
	command am_addr_t AMPacket.source(message_t* amsg){
		return call AMPacketM.source(amsg);
	}
	
	command void AMPacket.setDestination(message_t* amsg, am_addr_t addr){
		return call AMPacketM.setDestination(amsg, addr);
	}
	
	command void AMPacket.setSource(message_t* amsg, am_addr_t addr){
		return call AMPacketM.setSource(amsg, addr);
	}
	
	command bool AMPacket.isForMe(message_t* amsg){
		return call AMPacketM.isForMe(amsg);
	}
	
	command am_id_t AMPacket.type(message_t* amsg){
		return call AMPacketM.type(amsg);
	}
	
	command void AMPacket.setType(message_t* amsg, am_id_t t){
		return call AMPacketM.setType(amsg, t);
	}
	
	command am_group_t AMPacket.group(message_t* amsg){
		return call AMPacketM.group(amsg);
	}
	
	command void AMPacket.setGroup(message_t* amsg, am_group_t grp){
		return call AMPacketM.setGroup(amsg, grp);
	}
	
	command am_group_t AMPacket.localGroup(){
		return call AMPacketM.localGroup();
	}
		
}
